hFlis = int(input("Hæð flísar: "))
bFlis = int(input("Breidd flísar: "))
hFlatar = int(input("Hæð flatar: "))
bFlatar = int(input("Breidd flatar: "))

haegt = True

if hFlatar % hFlis != 0 and bFlatar % bFlis != 0:
	haegt = False
	
if hFlatar % (hFlis/2) != 0 or bFlatar % (bFlis/2) != 0:
	haegt = False
	
if haegt:
	print(str(int((hFlatar*bFlatar)/(hFlis*bFlis))))
else:
	print("ekki hægt")
